<?php
header("Content-type:text/html;charset=utf-8");
include('./framephp/helper.php');

//s 将字符串视为单行,换行符作为普通字符
// $pattern = "/imooc.+123/";
// $subject = "I love imooc_123123\n123123";
// $m1 = $m2 = array();
// $res1 = preg_match($pattern,$subject,$m1);
// p($subject);
// p($m1);
// p($res1);


//替换
$pattern = '/\{# *\$([a-zA-Z_]\w*) *#\}/';
$subject ='测试: {#$test #}';
//子模式单元
$subject = preg_replace($pattern,'imooc$1',$subject);
p($subject);
